import service from "../utils/request";

// 注册接口
export const registerAPI = (data) => {
    return service.post('/register', data)
}

// 登录接口
export const loginAPI = (data) => {
    return service.post('/user/login', data)
}

// 获取用户列表
export const getUserListAPI = (params) => {
    return service.get('/user/page', { params })
}

// 根据id删除用户
export const deleteUserAPI = (id) => {
    return service.delete(`/user/${id}`)
}

// 添加和编辑用户
export const saveUserAPI = (data) => {
    return service.post('/user', data)
}

// 根据username查询用户信息
export const getUserByUsernameAPI = (username) => {
    return service.get(`/userinfo/${username}`)
}